package com.foreknow.demo3;

public class ArrayDemo1 {
    public static void main(String[] args) {
        int[] arr  = new int[10];
        arr[0] = 1;;
        arr[1] = 2;
        System.out.println(arr[1]);
        System.out.println("————————————数组的遍历——————————");
        String[] arr1 = {"fender","gibson","yamaha"};
        System.out.println(arr1[1]);
        for (int i= 0;i < arr1.length;i++){
            System.out.println(arr1[i]);
        }
        //查找最小值
        System.out.println("————————————最小值——————————");
        int[] a = {23,22,12,11,15,28,12,25,76};
        int min = a[0];
        for (int i = 1;i<a.length;i++){
            if (a[i]<min){
                min = a[i];
            }
        }
        System.out.println(min);
        System.out.println("————————————二维数组——————————");
        int[][] array = new int[4][4];
        array[0][0] = 1;
        array[0][1] = 2;
        array[0][2] = 3;
        System.out.println(array[0][0]);
        System.out.println("————————————二维数组的遍历——————————");

        int[][] as = {{1,2,3},{4,5,6,7},{8,9,}};
        for (int i=0;i<as.length;i++){
            for (int j=0;j<as[i].length;j++){
                System.out.print(as[i][j]+"\t");
            }
            System.out.println();
        }
    }
}
